<?php

use think\facade\Route;

Route::group('v1', function () {
    //登入
    Route::post('/login', 'AuthController/login');
    //需要登入的api
    Route::group('',function (){

        //商品
        Route::get('/goods/:id', 'GoodsController/getById')->model(\app\model\Goods::class);
        Route::post('/goods', 'GoodsController/create');
        Route::get('/goods', 'GoodsController/get');
        Route::put('/goods/:id', 'GoodsController/update')->model(\app\model\Goods::class);
        Route::delete('/goods/:id', 'GoodsController/delete')->model(\app\model\Goods::class);


        //分类
        Route::get('/categories/:id', 'CategoryController/getById')->model(\app\model\Category::class);
        Route::post('/categories', 'CategoryController/create');
        Route::get('/categories', 'CategoryController/get');
        Route::put('/categories/:id', 'CategoryController/update')->model(\app\model\Category::class);
        Route::delete('/categories/:id', 'CategoryController/delete')->model(\app\model\Category::class);


        //供应商
        Route::get('/suppliers/:id', 'SupplierController/getById')->model(\app\model\Supplier::class);
        Route::post('/suppliers', 'SupplierController/create');
        Route::get('/suppliers', 'SupplierController/get');
        Route::put('/suppliers/:id', 'SupplierController/update')->model(\app\model\Supplier::class);
        Route::delete('/suppliers/:id', 'SupplierController/delete')->model(\app\model\Supplier::class);

        //加工方案
        Route::get('/machiningschemes/:id', 'MachiningSchemeController/getById')->model(\app\model\MachiningScheme::class);
        Route::post('/machiningschemes', 'MachiningSchemeController/create');
        Route::get('/machiningschemes', 'MachiningSchemeController/get');
        Route::put('/machiningschemes/:id', 'MachiningSchemeController/update')->model(\app\model\MachiningScheme::class);
        Route::delete('/machiningschemes/:id', 'MachiningSchemeController/delete')->model(\app\model\MachiningScheme::class);

        //标签
        Route::get('/tags/:id', 'TagController/getById')->model(\app\model\Tag::class);
        Route::post('/tags', 'TagController/create');
        Route::get('/tags', 'TagController/get');
        Route::put('/tags/:id', 'TagController/update')->model(\app\model\Tag::class);
        Route::delete('/tags/:id', 'TagController/delete')->model(\app\model\Tag::class);

    })->middleware(\app\middleware\JwtAuth::class);
});

